package com.zebra.base.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zebra.base.po.BaseEntity;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName VuePageForm
 * @Description TODO Form列表
 * @Author 消魂钉
 * @Date 5/29 0029 0:49
 * 分页的需要传 pageSize: 每页的条数；total:总条数；pageCount:总页数；currenttPage:当前页数
 */
@Data
@NoArgsConstructor
public class VuePageRes<T extends BaseEntity> extends QueryForm<T>{

    /**
     *  page
     */
   List<T> data = new ArrayList<>();

    public VuePageRes builder(IPage<T> page){
        this.data = page.getRecords();
        super.currentPage = page.getCurrent();
        super.pageSize = page.getSize();
        super.total = page.getTotal();
        super.pageCount = page.getPages();
        return this;
    }
}
